from ..models.sources_model import Sources
from sqlalchemy.orm import Session
from sqlalchemy import select
from fastapi import HTTPException
from ..models.grades_model import Grades

def get_all_grades(db: Session):
    query = select(Grades).order_by(Grades.id.asc())
    grades = db.execute(query).scalars().all()
    return [grade.as_dict() for grade in grades]


# if __name__ == "__main__":
#     from database.db import SessionLocal
#     db = SessionLocal()
#     grades = get_all_grades(db)
#     print(grades)